/* 问题表格样式 */
.problem-table {
  height: 100%;
  display: flex;
  flex-direction: column;
  margin: 0 20px; /* 增加左右边距 */
}

/* 增强表格样式 */
.enhanced-problem-table {
  height: 100%;
  display: flex;
  flex-direction: column;
  margin: 0 20px;
}

/* 增强的表格头部 */
.problem-table-enhanced-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: linear-gradient(to right, #fafafa, #f0f0f0);
  border-bottom: 2px solid #e8e8e8;
  border-radius: 6px 6px 0 0;
  margin-bottom: 0;
}

.problem-table-stats {
  display: flex;
  gap: 16px;
  align-items: center;
}

.stat-item-small {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 10px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  min-width: 60px;
}

.stat-value-small {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 2px;
  line-height: 1;
}

.stat-label-small {
  font-size: 11px;
  color: #666;
  line-height: 1;
}

.problem-table-header {
  padding: 16px 24px; /* 增加内边距 */
  background-color: #fafafa;
  border-bottom: 1px solid #e8e8e8;
  border-radius: 6px 6px 0 0;
  margin: 0 -20px 0 -20px; /* 补偿容器边距 */
}

/* 表格行样式 */
.problem-row {
  transition: all 0.2s;
}

.problem-row:hover {
  background-color: #f5f5f5 !important;
}

.problem-row-selected {
  background-color: #e6f7ff !important;
  border-left: 4px solid #1890ff;
}

.problem-row-selected:hover {
  background-color: #e6f7ff !important;
}

/* 区分AI和规则分析的行样式 */
.problem-row-ai {
  border-left: 2px solid #722ed1;
  background-color: #fafafa;
}

.problem-row-rule {
  border-left: 2px solid #1890ff;
  background-color: #ffffff;
}

.problem-row-ai:hover {
  background-color: #f0f0f0 !important;
}

.problem-row-rule:hover {
  background-color: #f5f5f5 !important;
}

/* 表格自定义样式 */
.problem-table .ant-table,
.enhanced-problem-table .ant-table {
  flex: 1;
  margin: 0 -20px; /* 补偿容器边距 */
  table-layout: fixed; /* 固定表格布局，防止列宽溢出 */
  width: 100% !important;
}

/* 强制表格列宽控制 */
.problem-table .ant-table-container,
.enhanced-problem-table .ant-table-container {
  width: 100% !important;
}

.problem-table .ant-table-content,
.enhanced-problem-table .ant-table-content {
  width: 100% !important;
}

/* 强制覆盖Ant Design默认列宽 */
.problem-table .ant-table-thead > tr > th,
.problem-table .ant-table-tbody > tr > td,
.enhanced-problem-table .ant-table-thead > tr > th,
.enhanced-problem-table .ant-table-tbody > tr > td {
  box-sizing: border-box !important;
}

/* 特别针对问题名称列 */
.problem-table .ant-table-thead > tr > th:nth-child(2),
.problem-table .ant-table-tbody > tr > td:nth-child(2),
.enhanced-problem-table .ant-table-thead > tr > th:nth-child(2),
.enhanced-problem-table .ant-table-tbody > tr > td:nth-child(2) {
  width: 160px !important;
  min-width: 160px !important;
  max-width: 160px !important;
  flex: 0 0 160px !important;
  box-sizing: border-box !important;
}

/* 列宽控制 - 更新后的列结构（增加严重程度列） */
.problem-table .ant-table-thead > tr > th:nth-child(1), /* SQL# */
.problem-table .ant-table-tbody > tr > td:nth-child(1),
.enhanced-problem-table .ant-table-thead > tr > th:nth-child(1),
.enhanced-problem-table .ant-table-tbody > tr > td:nth-child(1) {
  width: 70px;
  min-width: 70px;
  max-width: 70px;
}

.problem-table .ant-table-thead > tr > th:nth-child(2), /* 问题名称 */
.problem-table .ant-table-tbody > tr > td:nth-child(2),
.enhanced-problem-table .ant-table-thead > tr > th:nth-child(2),
.enhanced-problem-table .ant-table-tbody > tr > td:nth-child(2) {
  width: 180px !important;
  min-width: 180px !important;
  max-width: 180px !important;
  flex: 0 0 180px !important;
}

.problem-table .ant-table-thead > tr > th:nth-child(3), /* 严重程度 */
.problem-table .ant-table-tbody > tr > td:nth-child(3),
.enhanced-problem-table .ant-table-thead > tr > th:nth-child(3),
.enhanced-problem-table .ant-table-tbody > tr > td:nth-child(3) {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  text-align: center;
}

.problem-table .ant-table-thead > tr > th:nth-child(4), /* AI验证 */
.problem-table .ant-table-tbody > tr > td:nth-child(4),
.enhanced-problem-table .ant-table-thead > tr > th:nth-child(4),
.enhanced-problem-table .ant-table-tbody > tr > td:nth-child(4) {
  width: 70px;
  min-width: 70px;
  max-width: 70px;
  text-align: center;
}

.problem-table .ant-table-thead > tr > th:nth-child(5), /* 问题SQL片段 */
.problem-table .ant-table-tbody > tr > td:nth-child(5),
.enhanced-problem-table .ant-table-thead > tr > th:nth-child(5),
.enhanced-problem-table .ant-table-tbody > tr > td:nth-child(5) {
  width: 140px;
  min-width: 140px;
  max-width: 140px;
}

.problem-table .ant-table-thead > tr > th:nth-child(6), /* 修改建议 */
.problem-table .ant-table-tbody > tr > td:nth-child(6),
.enhanced-problem-table .ant-table-thead > tr > th:nth-child(6),
.enhanced-problem-table .ant-table-tbody > tr > td:nth-child(6) {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
}

.problem-table .ant-table-thead > tr > th:nth-child(7), /* SQL来源 */
.problem-table .ant-table-tbody > tr > td:nth-child(7),
.enhanced-problem-table .ant-table-thead > tr > th:nth-child(7),
.enhanced-problem-table .ant-table-tbody > tr > td:nth-child(7) {
  width: 110px;
  min-width: 110px;
  max-width: 110px;
}

.problem-table .ant-table-thead > tr > th:nth-child(8), /* 操作 */
.problem-table .ant-table-tbody > tr > td:nth-child(8),
.enhanced-problem-table .ant-table-thead > tr > th:nth-child(8),
.enhanced-problem-table .ant-table-tbody > tr > td:nth-child(8) {
  width: 60px;
  min-width: 60px;
  max-width: 60px;
  text-align: center;
}

.problem-table .ant-table-thead > tr > th,
.enhanced-problem-table .ant-table-thead > tr > th {
  background-color: #fafafa;
  border-bottom: 2px solid #e8e8e8;
  font-weight: 600;
  color: #262626;
  padding: 16px 12px; /* 增加内边距 */
  overflow: hidden; /* 防止内容溢出 */
}

.problem-table .ant-table-tbody > tr > td,
.enhanced-problem-table .ant-table-tbody > tr > td {
  padding: 16px 12px; /* 增加内边距 */
  vertical-align: top;
  overflow: hidden; /* 防止内容溢出 */
  word-wrap: break-word; /* 长单词换行 */
}

.problem-table .ant-table-tbody > tr:last-child > td,
.enhanced-problem-table .ant-table-tbody > tr:last-child > td {
  border-bottom: none;
}

/* 分页器样式 */
.problem-table .ant-pagination,
.enhanced-problem-table .ant-pagination {
  margin: 20px 0; /* 调整上下边距 */
  text-align: center;
}

.problem-table .ant-pagination-options,
.enhanced-problem-table .ant-pagination-options {
  margin-left: 16px;
}

/* 问题详情弹窗样式 */
.problem-detail {
  max-height: 60vh;
  overflow-y: auto;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.code-block {
  margin-top: 8px;
  background-color: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  padding: 12px;
  border-left: 3px solid #ff4d4f;
  overflow-x: auto;
}

.code-block.original {
  border-left-color: #ff4d4f;
  background-color: #fff2f0;
  border-color: #ffccc7;
}

.code-block.suggested {
  border-left-color: #52c41a;
  background-color: #f6ffed;
  border-color: #b7eb8f;
}

.code-block pre {
  margin: 0;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  color: #24292e;
  white-space: pre-wrap;
  word-break: break-all;
}

.suggestion-block {
  margin-top: 8px;
  padding: 8px 12px;
  background-color: #f6ffed;
  border: 1px solid #b7eb8f;
  border-radius: 6px;
  display: flex;
  align-items: flex-start;
}

/* 表格内的操作按钮样式 */
.problem-table .ant-btn[ant-click-animating-without-extra-node]:after,
.enhanced-problem-table .ant-btn[ant-click-animating-without-extra-node]:after {
  display: none;
}

.problem-table .ant-btn-text:hover,
.enhanced-problem-table .ant-btn-text:hover {
  background-color: rgba(24, 144, 255, 0.1);
  color: #1890ff;
}

/* 分类标签优化 */
.problem-table .ant-tag,
.enhanced-problem-table .ant-tag {
  border-radius: 10px;
  font-weight: 500;
  font-size: 11px;
  padding: 2px 8px;
  border: none;
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  box-sizing: border-box;
}

/* 表格滚动条样式 */
.problem-table .ant-table-body::-webkit-scrollbar,
.enhanced-problem-table .ant-table-body::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.problem-table .ant-table-body::-webkit-scrollbar-track,
.enhanced-problem-table .ant-table-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.problem-table .ant-table-body::-webkit-scrollbar-thumb,
.enhanced-problem-table .ant-table-body::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.problem-table .ant-table-body::-webkit-scrollbar-thumb:hover,
.enhanced-problem-table .ant-table-body::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* SQL片段展示优化 - 简化版本 */
.sql-fragment-container {
  background-color: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  color: #262626;
  line-height: 1.5;
  max-height: none;
  overflow: visible;
  position: static;
  transition: none;
}

.sql-fragment-container:hover {
  background-color: transparent;
  border: none;
  box-shadow: none;
}

/* 问题片段样式 - 简化 */
.sql-fragment-container.problem-fragment {
  background-color: transparent;
  border: none;
  color: #262626;
}

/* 问题名称列文本截断 */
.problem-table .ant-table-tbody > tr > td:nth-child(2),
.enhanced-problem-table .ant-table-tbody > tr > td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px !important;
  width: 160px !important;
}

/* 问题名称列悬停显示完整内容 */
.problem-table .ant-table-tbody > tr > td:nth-child(2):hover,
.enhanced-problem-table .ant-table-tbody > tr > td:nth-child(2):hover {
  white-space: normal;
  word-break: break-word;
  background-color: #fafafa;
  position: relative;
  z-index: 10;
}

/* 建议片段样式 - 简化 */
.sql-fragment-container.suggested-fragment {
  background-color: transparent;
  border: none;
  color: #262626;
}

.sql-fragment-text {
  display: block;
  overflow: visible;
  word-break: break-word;
  white-space: pre-wrap;
}

.sql-fragment-ellipsis {
  display: none;
}

/* 优化后SQL容器 */
.suggested-sql-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.suggested-sql-container .ant-btn {
  align-self: flex-start;
}

/* SQL关键字高亮 */
.sql-keyword {
  color: #0066cc;
  font-weight: 600;
}

.sql-string {
  color: #008800;
}

.sql-number {
  color: #cc6600;
}

.sql-comment {
  color: #808080;
  font-style: italic;
}

/* 置信度标签 */
.confidence-high { 
  background-color: #52c41a; 
  color: white;
}

.confidence-medium { 
  background-color: #faad14; 
  color: white;
}

.confidence-low { 
  background-color: #ff4d4f; 
  color: white;
}

/* 差异对比样式 */
.diff-comparison {
  padding: 16px 0;
}

.diff-section {
  height: 100%;
}

.diff-section .code-block {
  margin-top: 8px;
  max-height: 300px;
  overflow-y: auto;
}

/* AI规则ID特殊样式 */
.enhanced-problem-table .ai-rule-tag {
  border-style: dashed;
  background: linear-gradient(45deg, #f0f0f0, #fafafa);
}

/* 动画效果 */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.problem-table .ant-table-tbody > tr > td {
  padding: 16px 12px;
}

.problem-table .ant-table-thead > tr > th {
  padding: 16px 12px;
}

.problem-table-header {
  padding: 16px 24px;
}

.problem-table .ant-pagination {
  margin: 20px 0;
}

.problem-detail {
  max-height: 60vh;
}

.detail-section {
  margin-bottom: 16px;
}

/* 规则名称可点击样式 */
.rule-name-clickable {
  transition: all 0.2s ease;
}

.rule-name-clickable:hover {
  background-color: #f0f8ff !important;
  border-radius: 4px !important;
  padding: 2px 4px !important;
}

.rule-name-clickable:focus {
  background-color: #e6f7ff !important;
  border-radius: 4px !important;
  outline: none;
}

/* 问题详情中的问题名称可点击样式 */
.problem-name-clickable {
  transition: all 0.3s ease;
}

.problem-name-clickable:hover {
  background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%) !important;
  transform: scale(1.05) translateY(-1px);
  box-shadow: 0 4px 12px rgba(82, 196, 26, 0.4);
}

.problem-name-clickable:active {
  transform: scale(0.98);
}

.problem-name-clickable .anticon {
  transition: transform 0.3s ease;
}

.problem-name-clickable:hover .anticon {
  transform: rotate(15deg);
}

/* Git链接增强样式 */
.git-link-enhanced {
  background: linear-gradient(135deg, #f0f8ff 0%, #e6f7ff 100%);
  border-radius: 4px;
  padding: 2px 6px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.git-link-enhanced:hover {
  background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
  color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
  border: 1px solid #1890ff;
}

.git-link-enhanced:hover .ant-typography {
  color: white !important;
}

.git-link-enhanced:active {
  transform: translateY(0);
}

/* AI验证标签样式优化 */
.enhanced-problem-table .ant-tag {
  border-radius: 8px;
  font-weight: 500;
  font-size: 10px;
  padding: 2px 6px;
  border: none;
  margin: 0;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 筛选器样式 */
.filter-card {
  background: linear-gradient(135deg, #fafafa 0%, #f0f0f0 100%);
  border: 1px solid #e8e8e8;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-card .ant-select-selector {
  border-radius: 4px;
  border-color: #d9d9d9;
  transition: all 0.2s ease;
}

.filter-card .ant-select-selector:hover {
  border-color: #40a9ff;
}

.filter-card .ant-select-focused .ant-select-selector {
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* 表格滚动区域调整 */
.enhanced-problem-table .ant-table {
  border-radius: 6px;
  overflow: hidden;
}

.enhanced-problem-table .ant-table-container {
  border-radius: 6px;
}

/* AI验证列特殊样式 */
.ai-verification-column {
  text-align: center;
  padding: 8px 4px;
}

.ai-verification-column .ant-space {
  width: 100%;
  justify-content: center;
}

/* 问题名称列的规则ID样式优化 */
.enhanced-problem-table .rule-name-clickable {
  background: transparent;
  border: none;
  color: inherit;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: all 0.2s ease;
}

.enhanced-problem-table .rule-name-clickable:hover {
  background: rgba(24, 144, 255, 0.1) !important;
  color: #1890ff !important;
  text-decoration-color: #1890ff;
  border-radius: 3px !important;
  padding: 1px 3px !important;
}

/* 响应式调整 */
@media (max-width: 1200px) {
  .problem-table .ant-table-thead > tr > th:nth-child(2),
  .problem-table .ant-table-tbody > tr > td:nth-child(2),
  .enhanced-problem-table .ant-table-thead > tr > th:nth-child(2),
  .enhanced-problem-table .ant-table-tbody > tr > td:nth-child(2) {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
  }
  
  .problem-table .ant-table-thead > tr > th:nth-child(4),
  .problem-table .ant-table-tbody > tr > td:nth-child(4),
  .enhanced-problem-table .ant-table-thead > tr > th:nth-child(4),
  .enhanced-problem-table .ant-table-tbody > tr > td:nth-child(4) {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
  }
  
  .problem-table .ant-table-thead > tr > th:nth-child(5),
  .problem-table .ant-table-tbody > tr > td:nth-child(5),
  .enhanced-problem-table .ant-table-thead > tr > th:nth-child(5),
  .enhanced-problem-table .ant-table-tbody > tr > td:nth-child(5) {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
  }
}